Imports System.Windows.Forms

Public Class dlgfilename

    ' Entered file name.
    Private m_szFileName As String = ""

    ' Get file name.
    Function GetFileName() As String
        Return m_szFileName
    End Function

    ' OK button clicked.
    Private Sub OK_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click

        ' Check that something entered.
        If (txtFileName.Text = "") Then
            MsgBox("File name cannot be empty.", MsgBoxStyle.Information)
            Exit Sub
        Else
            m_szFileName = txtFileName.Text
        End If

        ' Close the dialog.
        Me.DialogResult = System.Windows.Forms.DialogResult.OK
        Me.Close()

    End Sub

    ' Cancel button clicked.
    Private Sub Cancel_Button_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCancel.Click

        ' Close the dialog.
        Me.DialogResult = System.Windows.Forms.DialogResult.Cancel
        Me.Close()

    End Sub

End Class
